<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="stylesheet" href="/stylesheets/style.css" />
    <script type="text/javascript" src="/javascripts/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="/javascripts/common.js"></script>
    <title><%= @user.name%>的微博</title>
  </head>
  <body>
    <div class="wrap">
      <div class="wrap-inner">
        <%= render :partial=>"/layouts/header"%>
        <div class="container">
          <div class="left-side">
            <div class="attention">
              <p><%= @user.name%>的关注（<%=@idols.size()%>）</p>
              <ul>
                <% @idols.each do |idol| %>
                  <li><a href="/user/<%=idol.idol.id%>"><img src="<%=idol.idol.image%>" alt="<%=idol.idol.name%>" title="<%=idol.idol.name%>"/><br/><%=idol.idol.name%></a></li>
                <%end%>
              </ul>
            </div>
            <hr />
            <div class="fans">
              <p><%= @user.name%>的粉丝（<%=@fensies.size()%>）</p>
              <ul>
                <% @fensies.each do |fensi| %>
                  <li><a href="/user/<%=fensi.fensi.id%>"><img src="<%=fensi.fensi.image%>" alt="<%=fensi.fensi.name%>" title="<%=fensi.fensi.name%>"/><br/><%=fensi.fensi.name%></a></li>
                <%end%>
              </ul>
            </div>
          </div>
          <div class="main">
            <div class="his_infos">
              <div class="left">
                <img src="<%=@user.image%>" alt="<%=@user.name%>"/>
              </div>
              <div class="right">
                <h1><%= @user.name%></h1>
                <p>
                  <%if @user.is_female%>
                    <img src="/images/icon_female.gif" alt="女"/>
                  <%end%>
                  <%if !@user.is_female%>
                    <img src="/images/icon_male.gif" alt="男"/>
                  <%end%>
                  <span><%=@user.city%></span>
                </p>
                <%if is_my_fensi(@user)%>
                  <p><a href="/cancel_f?idol=<%=@user.id%>" class="cancle">取消</a></p>
                <%end%>
                <%if !is_my_fensi(@user) && !is_current(@user)%>
                  <p><a href="/f?idol=<%=@user.id%>" class="pay-attention">加关注</a></p>
                <%end%>
              </div>
            </div>
            <div class="weibo-details">
              <div class="headline"><%= @user.name%>的微博</div>
              <%= will_paginate @weibos,{:prev_label=>'前一页', :next_label=>'下一页'} %>
              <ul>
                <% @weibos.each do |weibo| %>
                  <li>
                    <p><a href="/user/<%=weibo.user.id%>"><%= h weibo.user.name%>：</a><%= h weibo.content%></p>
                    <div class="bottom">
                      <span class="time"><%= h status_time_ago_in_words(weibo.created_at)%></span>
                      <span class="link">
                        <% if is_current weibo.user %>
                          <%= link_to "删除",weibo_path(weibo),:method=>:delete %> |
                        <%end%>
                       <% if is_not_my_favorite(@user,weibo) %>
                          <%= link_to '收藏', {:controller => 'favorite', :action => 'create',:weibo=>weibo.id}, {:method => :post } %> |
                        <%end%>
                        <a href="" class="link-comment">评论(<%=weibo.comments.size()%>)</a>
                      </span>
                    </div>
                    <div class="comment" style="display:none;">
                      <% form_for :comment, :url => "/weibo/#{weibo.id}/comment",:html=>{:method=>:post} do |f| %>
                        <div class="send-comment">
                          <%= f.text_area :content %>
                          <input type="hidden" name="comment[weibo_id]" value="<%= h weibo.id%>"/>
                          <input type="hidden" name="comment[user_id]" value="<%= h @user.id%>"/>
                          <input type="submit" value="发布" class="button-comment"/>
                        </div>
                      <%end%>
                      <ul>
                        <% weibo.comments.each do |comment| %>
                          <li>
                            <p>
                              <a href=""><%= h comment.user.name%>：</a><%= h comment.content%>
                              (<%= h status_time_ago_in_words(comment.created_at)%>)
                              <% if is_current comment.user %>
                                <%= link_to "删除",comment_path(comment),:method=>:delete %>
                              <%end%>
                            </p>
                          </li>
                        <%end%>
                      </ul>
                    </div>
                  </li>
                <% end %>
              </ul>
              <%= will_paginate @weibos,{:prev_label=>'前一页', :next_label=>'下一页'} %>
            </div>

          </div>
        </div>
        <div class="footer">
          Copyright &copy; 2011 WEIBO songhailin@gmail.com
        </div>
      </div>
    </div>
  </body>
</html>